/**
 * Created by Administrator on 2017/8/14.
 */
var testConfig = require('../testConfig');
function SearchProject() {
    this.beforeTr = 0;
    this.init = function () {
        var arr = [];
        arr.push(this.step1,
            this.step2,
            this.step3/*,
            this.step4,
            this.step5,
            this.step6,
            this.step7,
            this.step8,
            this.step9,
            this.step10,
            this.step11,
            this.step12*/);
        testConfig.testFun.runStep(arr);
    };
    this.step1 = function () {
        /***点击列表中版本修改 ***/
        window.jQuery("#job_测试-阿里云-版本修改 a").eq(1)[0].click();
    };
    this.step2 = function () {
        /***点击修改配置***/
        console.log("erwer");
        window.jQuery("#tasks .task a").eq(11)[0].click();
    };
    this.step3 = function () {
        /***找到构建脚本中对应项目的那行***/
        console.log(123123123);
        var configline = window.jQuery(".CodeMirror-lines pre:contains(auto-consoleWeb)");
    };
    this.step4 = function () {
        /***修改配置COMMITID***/
        var commitid = "5080f1100116611ee2f5193bea8f44f40a8d9afa";
        var newconfigline = "auto-consoleWeb:commit="+commitid+",tag=,branch=dist|\\";
        configline.text(newconfigline);
    };
    this.step5 = function () {
        /***保存配置***/
        window.jQuery("#yui-gen64-button")[0].click();
    };
    this.step6 = function () {
        /***立即构建***/
        window.jQuery("#tasks .task a").eq(9)[0].click();
    };
    this.step7 = function () {
        /***回到列表***/
        window.jQuery("#breadcrumbs a").eq(0)[0].click();
    };
    this.step8 = function () {
        /***准备构建对应项目***/
        window.jQuery("#job_测试-阿里云-前端-auto-consoleWeb a").eq(1)[0].click();
    };
    this.step9 = function () {
        /***点击立即构建***/
        window.jQuery("#yui-gen1-button")[0].click();
    };
    this.step10 = function () {
        /***点击蓝色小点，查看构建日志***/
        window.jQuery(".single-line a").eq(0)[0].click();
        setTimeout(console.log("等待构建日志"),10000);
    };
    this.step11 = function () {
        var buildlog = window.jQuery(".console-output").text();
        var buildResult = IsSuccess(buildlog);
        if (buildResult >= 0 ){
            alert("构建成功");
        }else{
            alert("构建失败");
        };
    };
    this.step12 = function () {
        console.log("结束");
    };
}
function testStart() {
    var test = new SearchProject();
    test.init();
}
exports.start = testStart;